
export function isObject(value) {
  return value && typeof value === 'object' && value.constructor === Object;
}
export function isNumber(any) {
  return !isNaN(parseFloat(any)) && isFinite(any) // eslint-disable-line
}
// filter the unnecessary props function
export const filterUnnecessaryProps = (props, filterNames) => {
  if (!Array.isArray(filterNames) || filterNames.length === 0) return props;
  const newProps = { ...props };
  filterNames.forEach((name) => {
    delete newProps[name]
  });
  return newProps
};
// get the necessary rest props
// @names: array
export function getNecessaryRestProps(props, names) {
  const rest = {}
  names.forEach((key) => {
    if (props[key] !== undefined) {
      rest[key] = props[key]
    }
  })
  return rest
}

// 精确舍入两位小数的方法
export function round(value, decimals) {
  return Number(Math.round(value + 'e' + decimals) + 'e-' + decimals);
}
